<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="parent">
        <p>good</p>
   
    </div>
    <script>
        // DOM就是增删改查元素的标准，可以动态的修改元素的内容，样式，结构，
        var parent=document.getElementById("parent");
        var p=document.getElementsByTagName("p")[0];
        var h2=document.createElement("h2");
        h2.innerHTML="标题";
        // repalceChild(newChild,oldChild)
        parent.replaceChild(h2,p);
    
    </script>
</body>
</html>